// .txt

beginzonescript;

variables;

short im_hostile = 0;
short last_abil;
short counter = 0;
short set_ter1 = 0;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();
	last_abil = last_abil - 8;

	sf(53,11,0);

					set_summon_level(30007,1);
					set_name(30007,"Rokaj Rebel");
				set_summon_level(30008,1);
					set_name(30008,"Rokaj Rebel");

	set_name(5342,"Geld Nas Tinkerer");
	set_name(5343,"Geld Nas Tinkerer");
	set_boss_level(5338,1);
	set_boss_level(5339,1);
	set_boss_level(5340,1);
	set_boss_level(5341,1);
	set_boss_level(5342,1);
	set_boss_level(5343,1);
	
	set_boss_level(30011,1);
	set_name(5350,"Cultist Oirios");
	set_boss_level(5350,2);
	set_name(5351,"Cultist Vanor");
	set_boss_level(5351,2);

	set_attack_range(30011,5);

//	add_ability(short which_char_or_group,short which_slot,short which_ability,0);

//	if (is_town_clear(ME))
//		clean_up_town();

	if (gf(53,12) > 0)
		erase_char(30010);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	//if ((set_ter1 == 0) && (gf(0,0) > 0)) {
	//	set_ter1 = 1;
	//	set_terrain(,,,);
	//	}
		
	// if (gf(,) == 0) {
	//if (get_ran(1,0,100) < 10)
	//	give_char_text_bubble(,"");
	//	}

	//if (gf(,) < 2) {
	//	inc_flag(,,1);
	//	if (gf(,) == 2)
	//		begin_talk_mode();
	//	}
	
	if (on_which_layer() == 1) {
		if ((gf(53,12) > 0) && (gf(53,13) == 0) && (is_talking() == FALSE) && (party_dist_to_spot(40,21) <= 4) && (num_chars_in_group(10) == 0)) {
			set_spec_item(14,1);
			sf(53,13,1);
			
			run_game_hardcode(1025);
			
			
			begin_talk_mode(19);
			}
		}
	if (on_which_layer() == 0) {
	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 4))) {
		last_abil = get_current_tick();
		counter = counter + 1;
		if (counter > 6) {
			set_terrain_string("The sound of a horn echoes through the valley.");
			if (gf(53,11) == 1) {
				if ((party_dist_to_spot(20,35) > 8) && (num_chars_in_group(4) == 0)) {
					activate_hidden_group(4);
					set_summon_level(30004,1);
					set_name(30004,"Rokaj Rebel");
					}
				}
			if (gf(53,11) == 2) {
				if ((party_dist_to_spot(37,17) > 8) && (num_chars_in_group(5) == 0)) {
					activate_hidden_group(5);
					set_summon_level(30005,1);
					set_name(30005,"Rokaj Rebel");
					}
				}
			counter = 0;
			}
		
		if (party_dist_to_spot(37,17) > 8) {
			if (char_ok(5300) == FALSE) {
				spawn_creature(5300);
				set_boss_level(5300,1);
				}
			if (char_ok(5301) == FALSE) {
				spawn_creature(5301);
				set_boss_level(5301,1);
				}
			if (char_ok(5302) == FALSE) {
				spawn_creature(5302);
				set_boss_level(5302,1);
				}
			
			set_summon_level(30001,1);
			set_name(30001,"Ka-Boar Artillerist");
			}
		if (party_dist_to_spot(20,35) > 8) {
			if (char_ok(5303) == FALSE) {
				spawn_creature(5303);
				set_boss_level(5303,1);
				}
			if (char_ok(5304) == FALSE) {
				spawn_creature(5304);
				set_boss_level(5304,1);
				}
			if (char_ok(5305) == FALSE) {
				spawn_creature(5305);
				set_boss_level(5305,1);
				}
			
			set_summon_level(30002,1);
			set_name(30002,"Ka-Boar Artillerist");
			}

		if (party_dist_to_spot(20,20) > 8) {
			if (char_ok(5306) == FALSE) {
				spawn_creature(5306);
				set_boss_level(5306,1);
				set_summon_level(5306,1);
				set_name(5306,"Ka-Boar Artillerist");
				}
			}
		if (party_dist_to_spot(42,38) > 8) {
			if (char_ok(5307) == FALSE) {
				spawn_creature(5307);
				set_boss_level(5307,1);
				set_summon_level(5307,1);
				set_name(5307,"Ka-Boar Artillerist");
				}
			}
		}
		}
break;

beginstate 10;
	sf(53,11,1);
break;

beginstate 11;
	sf(53,11,2);
break;

beginstate 12;
break;

beginstate 13;
break;

//	print_str("");
//	set_terrain_string_range(".",1);
//	set_terrain_string_range("The sign says - .",1);
